package com.zz.stringBuilder;

public class Test {
    public static void main(String args[]){
        StringBuilder s = new StringBuilder("tom");

        //1.拼接内容:append
        s.append(" is");
        s.append(" a ");
        s.append(12);
        s.append(" boy");

        //支持链式编程，因为调用append方法，返回的是this(当前对象)
        s.append(" that ").append(" is ").append("handsome");

        //2.反转操作
        s.reverse();

        //3.返回字符串的长度
        System.out.println(s.length());

        //4.把StringBuilder对象又转换成String类型
        String rs = s.toString();
        System.out.println(rs);

        System.out.println(s);
    }
}
